package com.gtq.uhome.controller;

import com.gtq.uhome.result.Result;
import com.gtq.uhome.service.OperatorLogService;
import com.gtq.uhome.vo.OperatorLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping(value = "/OperatorLog")
@CrossOrigin
@Api(tags = "系统管理——操作日志——何凡")
public class OperatorLogController {

    @Resource
    private OperatorLogService operatorLogService;//实例化
    /**
     * 查询所有后台管理员后台操作内容
     * @return Result<List<OperatorLog>> 后台管理员后台操作内容
     */
    @GetMapping(value = "/operatorLogAll")
    @ResponseBody
    @ApiOperation("查询所有角色操作信息")
    public Result<List<OperatorLog>>selectByOperatorLogAll(){
        return Result.ok(operatorLogService.selectOperatorLogAll());
    }

    /**
     * 根据条件查询所有后台管理员后台操作内容
     * @param operatorLog
     * @return Result<List<OperatorLog>> 后台管理员后台操作内容
     */
    @PostMapping(value = "/operatorLog")
    @ResponseBody
    @ApiOperation("根据条件查询所有角色操作信息")
    public Result<List<OperatorLog>>selectByOperatorLog(@RequestBody OperatorLog operatorLog){
        return Result.ok(operatorLogService.selectOperatorLogLike(operatorLog));
    }
}
